package inits

import (
	"2302a/testyuekao/global"
	"fmt"
	"github.com/streadway/amqp"
)

func InitRabbitMq() {
	//获取connection
	conn, err := amqp.Dial("amqp://2212alizi:2212alizi@14.103.169.255:5672/2212alizi")
	if err != nil {
		print("failed to connect rabbitmq!")
		return
	}
	//获取channel
	global.MQ, err = conn.Channel()
	if err != nil {
		print(err, "failed to open a channel")
		return
	}
	fmt.Println("to RabbitMq")

}
